﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FrameWork.Entity;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Collections;

namespace FrameWork.web.Code
{
    public class its_PromotersRegisterCs
    {
        public its_PromotersRegisterCs()
        {
            Microsoft.ApplicationBlocks.Data.SqlHelper.connectionString = ConfigurationManager.AppSettings["MsSql"].ToString();
        }
        /// <summary>
        /// 添加开发商登记信息
        /// </summary>
        /// <param name="_its_PromotersRegister"></param>
        public void PromotersRegister_Create(its_PromotersRegister _its_PromotersRegister)
        {
            SqlParameter[] sp = new SqlParameter[10]{
				new SqlParameter("@BeginTime",SqlDbType.DateTime),
				new SqlParameter("@Company",SqlDbType.NVarChar,100),
				new SqlParameter("@Visitor",SqlDbType.NVarChar,100),
				new SqlParameter("@Operate",SqlDbType.NVarChar,100),
				new SqlParameter("@LoginType",SqlDbType.NVarChar,100),
				new SqlParameter("@Influence",SqlDbType.NVarChar,1000),
				new SqlParameter("@FinishTime",SqlDbType.DateTime),
				new SqlParameter("@Reception",SqlDbType.NVarChar,100),
				new SqlParameter("@USERNO",SqlDbType.NVarChar,50),
				new SqlParameter("@USERName",SqlDbType.NVarChar,50),
			
			};
            //
            if (_its_PromotersRegister.BeginTime != DateTime.MinValue)
            {
                sp[0].Value = _its_PromotersRegister.BeginTime;
            }
            else
            {
                sp[0].Value = DBNull.Value;
            }

            sp[0].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Company != "")
            {
                sp[1].Value = _its_PromotersRegister.Company;
            }
            else
            {
                sp[1].Value = DBNull.Value;
            }

            sp[1].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Visitor != "")
            {
                sp[2].Value = _its_PromotersRegister.Visitor;
            }
            else
            {
                sp[2].Value = DBNull.Value;
            }

            sp[2].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Operate != "")
            {
                sp[3].Value = _its_PromotersRegister.Operate;
            }
            else
            {
                sp[3].Value = DBNull.Value;
            }

            sp[3].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.LoginType != "")
            {
                sp[4].Value = _its_PromotersRegister.LoginType;
            }
            else
            {
                sp[4].Value = DBNull.Value;
            }

            sp[4].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Influence != "")
            {
                sp[5].Value = _its_PromotersRegister.Influence;
            }
            else
            {
                sp[5].Value = DBNull.Value;
            }

            sp[5].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.FinishTime != DateTime.MinValue)
            {
                sp[6].Value = _its_PromotersRegister.FinishTime;
            }
            else
            {
                sp[6].Value = DBNull.Value;
            }

            sp[6].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Reception != "")
            {
                sp[7].Value = _its_PromotersRegister.Reception;
            }
            else
            {
                sp[7].Value = DBNull.Value;
            }

            sp[7].Direction = ParameterDirection.Input;


            //
            //if (_its_PromotersRegister.USERNO != "")
            //{
                sp[8].Value = _its_PromotersRegister.USERNO;
            //}
            //else
            //{
            //    sp[8].Value = DBNull.Value;
            //}

            sp[8].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.USERName != "")
            {
                sp[9].Value = _its_PromotersRegister.USERName;
            }
            else
            {
                sp[9].Value = DBNull.Value;
            }

            sp[9].Direction = ParameterDirection.Input;


            try
            {
                SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.its_PromotersRegister_Create", sp);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// 修改开发商登记信息
        /// </summary>
        /// <param name="_its_PromotersRegister"></param>
        public void PromotersRegister_Update(its_PromotersRegister _its_PromotersRegister)
        {
            SqlParameter[] sp = new SqlParameter[9]{
				new SqlParameter("@ID",SqlDbType.Int),
				new SqlParameter("@BeginTime",SqlDbType.DateTime),
				new SqlParameter("@Company",SqlDbType.NVarChar,100),
				new SqlParameter("@Visitor",SqlDbType.NVarChar,100),
				new SqlParameter("@Operate",SqlDbType.NVarChar,100),
				new SqlParameter("@LoginType",SqlDbType.NVarChar,100),
				new SqlParameter("@Influence",SqlDbType.NVarChar,1000),
				new SqlParameter("@FinishTime",SqlDbType.DateTime),
				new SqlParameter("@Reception",SqlDbType.NVarChar,100),
			
			};
            //
            if (_its_PromotersRegister.ID != int.MinValue)
            {
                sp[0].Value = _its_PromotersRegister.ID;
            }
            else
            {
                sp[0].Value = DBNull.Value;
            }

            sp[0].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.BeginTime != DateTime.MinValue)
            {
                sp[1].Value = _its_PromotersRegister.BeginTime;
            }
            else
            {
                sp[1].Value = DBNull.Value;
            }

            sp[1].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Company != "")
            {
                sp[2].Value = _its_PromotersRegister.Company;
            }
            else
            {
                sp[2].Value = DBNull.Value;
            }

            sp[2].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Visitor != "")
            {
                sp[3].Value = _its_PromotersRegister.Visitor;
            }
            else
            {
                sp[3].Value = DBNull.Value;
            }

            sp[3].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Operate != "")
            {
                sp[4].Value = _its_PromotersRegister.Operate;
            }
            else
            {
                sp[4].Value = DBNull.Value;
            }

            sp[4].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.LoginType != "")
            {
                sp[5].Value = _its_PromotersRegister.LoginType;
            }
            else
            {
                sp[5].Value = DBNull.Value;
            }

            sp[5].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Influence != "")
            {
                sp[6].Value = _its_PromotersRegister.Influence;
            }
            else
            {
                sp[6].Value = DBNull.Value;
            }

            sp[6].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.FinishTime != DateTime.MinValue)
            {
                sp[7].Value = _its_PromotersRegister.FinishTime;
            }
            else
            {
                sp[7].Value = DBNull.Value;
            }

            sp[7].Direction = ParameterDirection.Input;


            //
            if (_its_PromotersRegister.Reception != "")
            {
                sp[8].Value = _its_PromotersRegister.Reception;
            }
            else
            {
                sp[8].Value = DBNull.Value;
            }

            sp[8].Direction = ParameterDirection.Input;


            try
            {
                SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "dbo.its_PromotersRegister_Update", sp);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }


    }
}
